package com.xbongbong.saas.enums.business;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.paas.enums.ScreenTypeEnum;
import com.xbongbong.saas.enums.SelectProductEnum;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.base.ContractBaseEnum;
import lombok.Getter;

import java.util.Objects;

@Getter
public enum WaitPurchaseProductEnum {


    /**
     * 一键采购
     **/
    OPTION("option_1","enum.listOption.attrName.option",FieldTypeEnum.OPTION.getType(),"option", XbbRefTypeEnum.WAIT_PURCHASE.getCode(),1),
    /**
     * 产品图片
     **/
    PRODUCT_IMGS("file_1","enum.product.attrName.product_imgs",FieldTypeEnum.IMAGE.getType(),"productImgs", XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),1),
    /**
     * 产品名称
     **/
    PRODUCT_NAME("productName","enum.selectProduct.attrName.product_name",FieldTypeEnum.TEXT.getType(),"productName",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),2),
    /**
     * 产品编号
     **/
    PRODUCT_NO("productNo","enum.selectProduct.attrName.product_no",FieldTypeEnum.TEXT.getType(),"productNo",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),3),
    /**
     * 产品规格
     **/
    SPECIFICATION("specification","enum.selectProduct.attrName.specification",FieldTypeEnum.TEXT.getType(),"specification",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),4),
    /**
     * 销售单位
     **/
    UNIT("text_8","enum.waitOutstock.attrName.unit",FieldTypeEnum.COMBO.getType(),"unit",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),5),
    /**
     * 供应商
     **/
    SUPPLIER("text_9", "enum.product.attrName.supplier", FieldTypeEnum.LINK_BUSINESS_MULTI.getType(),"supplier",XbbRefTypeEnum.WAIT_PURCHASE.getCode(),6),

    /**
     * 备注
     **/
    MEMO("memo","enum.selectProduct.attrName.memo",FieldTypeEnum.TEXTAREA.getType(),"memo",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),7),

    /**
     * 销售数量
     **/
    NUM(SelectProductEnum.NUM.getAttr(),"enum.waitPurchase.attrName.num",SelectProductEnum.NUM.getFieldType(),SelectProductEnum.NUM.getSaasAttr(), XbbRefTypeEnum.WAIT_PURCHASE.getCode(),8),
    /**
     * 已采购数量
     **/
    PURCHASE_NUM("purchaseNum","enum.waitPurchase.attrName.purchase_num",SelectProductEnum.NUM.getFieldType(),"purchaseNum", XbbRefTypeEnum.WAIT_PURCHASE.getCode(),9),
    /**
     * 已入库数量
     **/
    INSTOCK_NUM("instockNum","enum.waitPurchase.attrName.instock_num",SelectProductEnum.NUM.getFieldType(),"instockNum", XbbRefTypeEnum.WAIT_PURCHASE.getCode(),10),
    /**
     * 出库数量
     **/
    OUTSTOCK_NUM("outstockNum","enum.waitPurchase.attrName.outstock_num",SelectProductEnum.NUM.getFieldType(),"outstockNum", XbbRefTypeEnum.WAIT_PURCHASE.getCode(),11),
    /**
     * 未出库数量
     **/
    WAIT_OUTSTOCK_NUM("waitOutstockNum","enum.waitPurchase.attrName.wait_outstock_num",FieldTypeEnum.NUM.getType(),"waitOutstockNum",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),12),

    /**
     * 建议采购数量
     **/
    ADVISE_PURCHASE_NUM("advisePurchaseNum","enum.waitPurchase.attrName.advise_purchase_num",FieldTypeEnum.NUM.getType(),"advisePurchaseNum",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),13),

    /**
     * 以销定购明细
     **/
    PURCHASE_DETAIL("purchaseDetail","enum.waitPurchase.attrName.purchase_detail",FieldTypeEnum.TEXT.getType(),"purchaseDetail",XbbRefTypeEnum.WAIT_PURCHASE.getCode(),14),


    /**
     * 合同名称
     **/
    NAME("text_1", "enum.contract.attrName.name", FieldTypeEnum.TEXT.getType(),"text_1",XbbRefTypeEnum.CONTRACT.getCode(),15),
    /**
     * 合同编号
     **/
    CONTRACT_NO(ContractBaseEnum.CONTRACT_NO.getAttr(), "enum.contract.attrName.contract_no",  FieldTypeEnum.SERIALNO.getType(),"serialNo",XbbRefTypeEnum.CONTRACT.getCode(),16),
    /**
     * 客户名称
     **/
    LINK_CUSTOMER(ContractBaseEnum.LINK_CUSTOMER.getAttr(), "enum.contract.attrName.link_customer", FieldTypeEnum.TEXT.getType(),"text_2",XbbRefTypeEnum.CONTRACT.getCode(),17),
    /**
     * 创建人
     **/
    CREATOR_ID(ContractBaseEnum.CREATOR_ID.getAttr(), "enum.contract.attrName.creator_id",FieldTypeEnum.CREATORID.getType(),"creatorId",  XbbRefTypeEnum.CONTRACT.getCode(),18),
    /**
     * 添加时间
     **/
    ADD_TIME(ContractBaseEnum.ADD_TIME.getAttr(), "enum.contract.attrName.add_time", FieldTypeEnum.ADDTIME.getType(),"addTime",  XbbRefTypeEnum.CONTRACT.getCode(),19),
    /**
     * 更新时间
     **/
    UPDATE_TIME(ContractBaseEnum.UPDATE_TIME.getAttr(), "enum.contract.attrName.update_time", FieldTypeEnum.UPDATETIME.getType(),"updateTime",  XbbRefTypeEnum.CONTRACT.getCode(),20),
    /**
     * 库存查询
     **/
    STOCK_SEARCH("stockSearch","enum.pageTitle.name.stock_search",FieldTypeEnum.TEXT.getType(),"stock_search",XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),21),

    ;

    private String attr;

    private String attrName;

    private Integer fieldType;

    private String saasAttr;

    private Integer linkedType;

    private Integer sort;

    WaitPurchaseProductEnum(String attr, String attrName, Integer fieldType, String saasAttr, int linkedType, int sort) {
        this.attr = attr;
        this.attrName = attrName;
        this.fieldType = fieldType;
        this.saasAttr = saasAttr;
        this.linkedType = linkedType;
        this.sort = sort;
    }
    public static Integer getSortByWaitPurchaseProductSort(String attr){
        for (WaitPurchaseProductEnum waitOutstockEnum : WaitPurchaseProductEnum.values()){
            if (Objects.equals(attr,waitOutstockEnum.getAttr())){
                return waitOutstockEnum.getSort();
            }
        }
        return 0 ;
    }



    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }



}
